home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS6.ZIP / DOSTIME < prev    next >
Text File  |  1987-01-22  |  3KB  |  114 lines

  1.                           Better Setter
  2.        (PC Magazine Vol 6 No 3 Feb 10, 1987 User-to-User)
  3.  
  4.      SETCLOCK.COM reads the current time and date from DOS and uses
  5. these values to update the IBM AT's clock.  This works with the AT
  6. only!  To use it, set the time with the DOS TIME command, and then
  7. just type SETCLOCK to make it stick.
  8.      Assemble SETCLOCK.COM from SETCLOCK.ASM, run the SETCLOCK.BAS
  9. program, or redirect SETCLOCK.SCR into DEBUG's mini-assembler with
  10. the command:
  11.  
  12. DEBUG < SETCLOCK.SCR
  13.  
  14. ; SETCLOCK.ASM
  15. .286c
  16. convert    macro    arg1
  17.     xchg    arg1,ax
  18.     call    bcdcnv
  19.     xchg    arg1,ax
  20.     endm
  21. cseg    segment    para public 'code'
  22.     assume    cs:cseg
  23.     org    100h
  24. start    proc    far
  25.     mov    ax,0FFFFh
  26.     mov    ds,ax
  27.     cmp    byte ptr [ds:0Eh]
  28.     jne    error
  29.     mov    ah,2Ah
  30.     int    21h
  31.     xchg    cx,ax
  32.     mov    bl,100
  33.     div    bl
  34.     xchg    ah,al
  35.     xchg    cx,ax
  36.     convert    cx
  37.     convert    dx
  38.     mov    ah,5
  39.     int    1Ah
  40.     mov    ah,2Ch
  41.     int    21h
  42.     convert    cx
  43.     mov    dl,0
  44.     convert    dx
  45.     mov    ah,3
  46.     int    1Ah
  47.     mov    al,0
  48. exit:    mov    ah,4Ch
  49.     int    21h
  50. error:    mov    dx,offset msg
  51.     mov    ah,9
  52.     int    21h
  53.     mov    al,1
  54.     jmp    exit
  55. start    endp
  56. bcdcnv    proc    near
  57.     mov    bl,ah
  58.     aam
  59.     shl    ah,4
  60.     or    al,ah
  61.     xchg    al,bl
  62.     aam
  63.     shl    ah,4
  64.     or    ah,al
  65.     mov    al,bl
  66.     ret
  67. bcdcnv    endp
  68. msg    db    'CPU is not an AT$'
  69. cseg    ends
  70.     end    start
  71.  
  72.  
  73. 100 'SETCLOCK.BAS
  74. 110 CLS:PRINT "Checking DATA ...."
  75. 120 FOR B=1 TO 7:FOR C=1 TO 17:READ A$:IF C<17 THEN 140
  76. 130 Z#=Z#+VAL(A$)
  77. 140 NEXT:NEXT
  78. 150 IF Z#=13508 THEN RESTORE:GOTO 180
  79. 160 PRINT "Error.  Check the last number in"
  80. 170 PRINT "each DATA statement; then redo.":END
  81. 180 FOR B=1 TO 7:FOR C=1 TO 16:READ A$:TTL=TTL+VAL("&H"+A$)
  82. 190 NEXT
  83. 200 READ S:IF S=TTL THEN 220
  84. 210 PRINT "DATA error in line";B*10+260:END
  85. 220 TTL=0:NEXT:RESTORE
  86. 230 OPEN "SETCLOCK.COM" AS #1 LEN=1:FIELD #1,1 AS D$
  87. 240 FOR B=1 TO 7:FOR C=1 TO 16:READ A$
  88. 250 LSET D$=CHR$(VAL("&H"+A$)):PUT #1:NEXT:READ DUMMY$:NEXT
  89. 260 LSET D$=CHR$(36):PUT #1:CLOSE:PRINT "SETCLOCK.COM created."
  90. 270 DATA B8,FF,FF,8E,D8,80,3E,0E,00,FC,75,34,B4,2A,CD,21,2137
  91. 280 DATA 91,B3,64,F6,F3,86,E0,91,91,E8,2F,00,91,92,E8,2A,2405
  92. 290 DATA 00,92,B4,05,CD,1A,B4,2C,CD,21,91,E8,1D,00,91,B2,1753
  93. 300 DATA 00,92,E8,16,00,92,B4,03,CD,1A,B0,00,B4,4C,CD,21,1630
  94. 310 DATA BA,60,01,B4,09,CD,21,B0,01,EB,F1,8A,DC,D4,0A,C0,2135
  95. 320 DATA E4,04,0A,C4,86,C3,D4,0A,C0,E4,04,0A,E0,8A,C3,C3,2175
  96. 330 DATA 43,50,55,20,69,73,20,6E,6F,74,20,61,6E,20,41,54,1273
  97.  
  98.  
  99. SETCLOCK.SCR:
  100.  
  101. E 100  B8,FF,FF,8E,D8,80,3E,0E,00,FC,75,34,B4,2A,CD,21
  102. E 110  91,B3,64,F6,F3,86,E0,91,91,E8,2F,00,91,92,E8,2A
  103. E 120  00,92,B4,05,CD,1A,B4,2C,CD,21,91,E8,1D,00,91,B2
  104. E 130  00,92,E8,16,00,92,B4,03,CD,1A,B0,00,B4,4C,CD,21
  105. E 140  BA,60,01,B4,09,CD,21,B0,01,EB,F1,8A,DC,D4,0A,C0
  106. E 150  E4,04,0A,C4,86,C3,D4,0A,C0,E4,04,0A,E0,8A,C3,C3
  107. E 160  "CPU is not an AT$"
  108. RCX
  109. 71
  110. N SETCLOCK.COM
  111. W
  112. Q
  113.  
  114.